{% extends 'common.html'%}
    {% block content %}

        <form class="layui-form" id="extra_from">
            {% if extra %}
                {% for item in extra %}
                    {% if item.get('type') =='input' %}
                        <div class="layui-form-item">
                            <label for="{{item.get('name')}}" class="layui-form-label">
                             <span class="we-red">*</span>{{item.get('title')}}
                             </label>
                            <div class="layui-input-inline">
                                <input type="text" id="{{item.get('name')}}" name="{{item.get('name')}}" required="" lay-verify="required" autocomplete="off" class="layui-input" value="{{item.get('default')}}">
                            </div>
                            <div class="layui-form-mid layui-word-aux">{{item.get('desc')}}</div>
                        </div>
                    {% elif item.get('name') =='select' %}

                    {% elif item.get('name') =='checkbox' %}
                        <div class="layui-form-item">
                            <label for="{{item.get('name')}}" class="layui-form-label">{{item.get('title')}}</label>
                            <div class="layui-input-inline">
                              <input id="{{item.get('name')}}" type="checkbox" name="{{item.get('name')}}" lay-skin="switch" checked="item.get('default')}}">
                            </div>
                            <div class="layui-form-mid layui-word-aux">{{item.get('desc')}}</div>
                        </div>
                    {% elif item.get('name') =='textarea' %}
                        <div class="layui-form-item">
                            <label for="{{item.get('name')}}" class="layui-form-label">
                             {{item.get('title')}}
                             </label>
                            <div class="layui-input-inline">
                                <textarea id="{{item.get('name')}}" name="{{item.get('name')}}"  class="layui-textarea">{{item.get('default')}}</textarea>
                            </div>
                            <div class="layui-form-mid layui-word-aux">{{item.get('desc')}}</div>
                        </div>
                    {% else %}

                    {% endif %}

                {% endfor %}
            {% endif %}



		</form>
            <div class="layui-form-item">
                <button id="extra_comfirm" class="layui-btn" lay-filter="add" lay-submit="">确定</button>
            </div>


        <script type="text/javascript" src="/static/lib/layui/layui.js" charset="utf-8"></script>

        <script>
			layui.use(['jquery', 'layer'], function() {
				var $ = layui.jquery,
					layer = layui.layer;
                $('#extra_comfirm').on('click', function(){
                    extravalue = $("#extra_from").serialize();
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.$('#query_extra').data('value',extravalue);
                    parent.layer.close(index);
                    parent.$('#query_extra').trigger('click');


                });

			});
        </script>

    {% endblock %}